home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc B) / Acorn User China CD-ROM (UK) (Disc B).bin / STUTTGART / EDITORS / ED / !Ed_!Help < prev    next >
Encoding:
Text File  |  1990-06-21  |  15.5 KB  |  361 lines

  1. Ed - An Editor for C source code
  2.  
  3. VERSION 0.2  Wed,20 Jun 1990
  4.  
  5.  
  6. CONTENTS
  7.           1)  COMMANDS
  8.               1.1) STARTING Ed
  9.               1.2) ENTERING TEXT
  10.               1.3) MOVING AROUND
  11.               1.4) FOLDING
  12.               1.5) THE MARK
  13.               1.6) DELETION
  14.               1.7) NOTES
  15.               1.8) FILE OPERATIONS
  16.               1.9) PRINTING
  17.              1.10) SEARCHING
  18.              1.11) OS COMMANDS
  19.              1.12) CONTROL CHARACTERS
  20.              1.13) MEMORY
  21.           2)  COMMENTS
  22.               2.1) PHILOSOPHY
  23.               2.2) WARNINGS
  24.               2.3) RECONSTRUCTING THE OBJECT CODE
  25.               2.4) HOW IT WORKS
  26.               2.5) KNOWN PROBLEMS
  27.               2.6) CHANGES FROM VERSION 0.0
  28.               2.7) TO DO
  29.               2.8) COMMENTS PLEASE
  30.  
  31. STARTING Ed
  32.  
  33.    Ed is a standard RISC_OS application. It is started by double clicking on
  34. its icon, it then installs itself as an icon on the iconbar.
  35.    Ed needs the filer to have seen !System, and to find version 3.50 or
  36. later of the shared c library in the system:modules directory.
  37.    To create a new text file click on the iconbar icon. 
  38.    To load a text file double click on its icon while Ed is on the iconbar.
  39.    To load any date stamped file drag it onto the iconbar icon.
  40.  
  41.    You can also start Ed from the command line with
  42.  
  43.      *Run !Ed.!Run <filename> ...  <filename>
  44.    
  45.    The named files are loaded into Ed.
  46.  
  47.    If you want to load Ed automatically when you double click on a text file
  48. take a copy of the !Edit.!Boot file from Edit and put it into the !Ed
  49. directory.
  50.  
  51.    Ed is controlled by keypresses and two menus, one for each window and one
  52. on the iconbar icon. The keypresses are directed to the window that contains
  53. the caret. This is identified by a buff coloured title bar. You can place
  54. the caret in the text by clicking select.
  55.    The line containing the caret is called the current line, the window
  56. containing this line the current window, and the document displayed in this
  57. window the current document.
  58.    To avoid confusion between Ed and Edit I have used green scroll bar
  59. backgrounds in Ed. If you don't like this you can edit the Templates file.
  60.  
  61.   You can get a keystrip for Ed by printing the Draw file !Ed.Strip .
  62.   You can recreate or alter !Ed.Strip from !Ed.EdStrip if you have my
  63.   DrawStrip application.
  64.  
  65. ENTERING TEXT
  66.  
  67.    You can enter text at the caret by typing. The maximum length of a line
  68. is 108 characters. If you try to enter more than this Ed will beep and
  69. ignore you.
  70.  
  71.    <Insert>      Start a new line below the current line.
  72.    F7            Split the current line at the caret position.
  73.    <Return>      Usually as <Insert> - see CONTROL CHARACTERS below.
  74.    <Shift>F7     Join the current line to the line above.
  75.  
  76.    The above keys attempt to indent the line suitably.
  77.  
  78.    <Shift>F8     Attempt to tidy the indentation from the current line
  79.                    to the next blank line, folded line or note.
  80.  
  81.    <Ctrl>Fn  1<=9<=9
  82.                  Enter the function key string.
  83.    <CtrlShift>Fn 1<=n<=9
  84.                  Set the function key string to the text of the current line.
  85.  
  86.    Control codes and top bit set characters cannot be entered into the text.
  87. If you try to enter a top bit set character (e.g. using !Chars) the
  88. corresponding \xNN escape sequence is entered.
  89.  
  90.  
  91. MOVING AROUND
  92.  
  93.    You can move around the file using the standard keys.
  94.  
  95.    cursor keys          Up,down,left or right one space
  96.    control cursor keys  Start,end,start of line or end of line.
  97.    page up / down       Page up / down !
  98.    F2                   Go to the marked line. (see below)
  99.    F4                   Go to the next note.   (see below)
  100.    
  101.    You can go to a line number from the window menu.
  102.  
  103. FOLDING
  104.  
  105.    In order to get as much code on the screen as possible Ed implements a
  106. simple form of folding. A fold of text is retained in the document, but only
  107. the top line is visible on the screen. A folded line is displayed in dark
  108. blue.
  109.    Ed folds the document at blank lines. If you fold the whole document each
  110. fold consists of a block of non-blank lines and all the blank lines that
  111. follow it. Folding is to one level only.
  112.  
  113.    F9            Fold  the whole document.
  114.    <shift>F9     Unfold the whole document.
  115.    F10           Unfold the current line.
  116.    <shift>F10    Fold the largest possible block of unfolded lines
  117.                  around the current line.
  118.    F11           Fold between the mark and the current line.
  119.  
  120. THE MARK
  121.  
  122.    A line can be marked in each document. The marked line is indicated by a
  123. grey background. It is used with the current line to delineate blocks.
  124.  
  125.    F1            Set mark.
  126.    <Shift>F1     Clear mark.
  127.    F2            Go to the mark.
  128.  
  129.    F5            Copy the marked line after the current line.
  130.    <shift>F5     Move the marked line after the current line.
  131.  
  132. Block moves and copies can be made by moving or copying a folded line.
  133.  
  134. Copy and move use the most recently marked line to decide which document to
  135. use, allowing copy or move between documents. After copy or move the mark
  136. and current line are moved on one line, so you can copy or move a small
  137. block by repeatedly pressing F5 or <shift>F5.
  138.  
  139. DELETION
  140.  
  141.    <delete>      Delete the character to the left of the caret.
  142.    F6            Delete all characters to the left of the caret.
  143.    <Shift>F6     Delete all characters to the right of the caret.
  144.    F8            Delete the current line. NOTE if this line is folded the
  145. whole fold is deleted!
  146.  
  147. NOTES
  148.  
  149.    Temporary notes can be inserted in the file. They are whole lines. They
  150. can be used for reminders or to help find your place. They are not saved
  151. when the file  is saved.
  152.    Notes are displayed in red. Folded notes are in green.
  153.    You can insert a file of notes after given line numbers. The main use of
  154. this is to read the error messages from the Acorn ANSI c compiler as notes.
  155. Each note goes after the line it applies to.
  156.    To do this take the Note option from the window menu. The named file is
  157. searched for lines begining with a given prefix followed by a line number.
  158.    The default filename is the same as the source file with the last letter
  159. of the directory changed to l. The default prefix is "  "name" line ",where
  160. name is (the last letter of the directory).leafname . 
  161.  If you spool the error messages from the c compiler to a file with the same
  162. name as the source file but the last letter of the directory changed to  l
  163. you will only need to click on <OK>. See !Ed.Makefile for one way to do
  164. this.The line numbers will only be correct if the source file has not been
  165. edited or folded.
  166.  You may need to alter the filename or prefix for errors in a #include file,
  167. or if you include notes from one of the unix type utilities that produce
  168. similar lists. The program can be set to ignore case in the prefix, or to
  169. attempt to use #line directives.
  170.  
  171.    F3            Start a new note line.
  172.    <Shift>F2     Make a text line into a note line.
  173.    <Shift>F3     Make a note line into a text line.
  174.    <Shift>F4     Make consecutive note lines from the current line on 
  175.                  into a comment.
  176.    F4            Go to the next note.
  177.  
  178. FILE OPERATIONS
  179.  
  180.    Text files can be included at the caret position by dragging their icon
  181. into the current window.
  182.    A document can be saved from the window menu using the usual RISC_OS
  183. method. When a document is saved all blank lines are stripped from the end
  184. unless they contain the caret or the mark. If you save a folded document
  185. the folded text is included.
  186.    A line can also be saved from the window menu. Folded lines can be saved
  187. to save a block.
  188.  
  189. PRINTING 
  190.    
  191.    <Print>       Print the document the current document.
  192.    <ShiftPrint>  Print the marked line.
  193.  
  194.    You can also print by saving to a printer driver.
  195.  
  196. SEARCHING
  197.  
  198.    Various searching options are avaliable from the find option of the
  199. window menu. The previous ten search criteria are stored and can be stepped
  200. through using [Previous] and [Next].
  201.    If the [List] option is chosen a new document is created containing all
  202. the lines found containing the search string.
  203.    If the [Comments] option is not chosen the search attempts to exclude
  204. comments and strings.
  205.    If the [Name] option is chosen the search only matches strings that are
  206. not preceded or succeeded by a letter, number or underline.
  207.    If the [Whole] option is chosen, or the caret is not in the window
  208. selected the search starts at the start of the document, otherwise it starts
  209. at the beginning of the line containing the caret.
  210.    If the [Folded] option is chosen the search includes folded text.
  211.    When a match is found the caret is placed before it, and you have the
  212. usual replacement options. If the match is inside a fold you have the
  213. additional option of unfolding to see it. 
  214.  
  215. OS COMMANDS
  216.   Ed allows the usual F12 option to obtain a command line.
  217.   You can also execute a (possibly folded) line of a document as a command.
  218.   The resulting screen output can be redirected to an Ed document. The line
  219. is saved as an obey file <EdTemp $Dir>.ToDo and * obeyed possibly with
  220. redirection to <EdTemp$Dir>.Output. The system variable <EdTemp$Dir> is
  221. presently set in !Run to RAM:. If you do not have a ram disk configured you
  222. will need to set this to some  other suitable directory.
  223.  
  224.    F12         Open command line.
  225.    <Shift>F11  Obey a line. 
  226.    <Shift>F12  Obey a line and spool output to a new Ed window.
  227.  
  228. CONTROL CHARACTERS
  229.  
  230.    The <Ctrl>X keys look for a system variable Ed$X and pass it to Ed's key
  231. interpreter, X can be a letter or [\]^_. You can enter text or other control
  232. characters. The string &XXX where XXX are THREE hex digits are interpreted
  233. as the key press with code XXX so you can use any of Ed's key commands.&& is
  234. interpreted as &. At present a few of these are defined in the !Run file.
  235. You can edit these to suit.The present ones are:-
  236.    <Ctrl>B     Start a c block.
  237.    <Ctrl>T     Enter the time.
  238.    <Ctrl>D     Enter the date.
  239.    <Ctrl>Y     Enter the year.
  240.    <Ctrl>C     Enter a copyright message (You will need to change this!)
  241.    <Ctrl>M     This is equivalent to <Return> and is set to the <Insert> key.
  242.  
  243.                  If you would prefer <Return> to use the 'split' key F7, so
  244. that return operates as in Edit, rather than as in the BASIC editor, you can
  245. change the line in the !Run file to :-
  246.                          Set Ed$M &187
  247.     Some other examples
  248.                          Set Ed$\ &181&1AF&18E&18EMODIFIED |D&182&191
  249.     Makes <Ctrl>\ put a modification date in the 4th line of the program.
  250.                          Set Ed$Z &1CDWIPE :4 ~CFR~V &1DB&188 
  251.     Makes <Ctrl>Z wipe your hard disk for you !
  252.  
  253. MEMORY
  254.  
  255.    Ed obtains memory for documents from the wimp pool. It does not give this
  256. back unless you close all documents. ( A document is closed when all its
  257. windows are  closed) . 
  258.  
  259. PHILOSOPHY
  260.  
  261.    Ed is designed specifically for the editing of c source code. In fact for
  262. editing code in the way I write c.
  263.    One of the major problems with programming at the keyboard is the amount
  264. of code you can fit on the screen at once, folding is one way of avoiding
  265. this. As nothing other than the text can be saved I decided to split the
  266. folds at blank lines. I only put blank lines between procedures so this
  267. works fairly well. I did try recursive folding using multiple blank lines,
  268. but this was far too confusing to use.
  269.   I have tried to make Ed as similar to Edit as possible. One major question
  270. was the operation of <Return>. In the end I decided let it create a new
  271. blank line like the BASIC editor rather than split as in Edit, if you don't
  272. like this see CONTROL CHARACTERS above.
  273.   If you don't like my other key assignments you can change them by editing
  274. the procedure keyop(int) in c.Edkeys.
  275.   Another important point was the [Name] option in the search menu. I was
  276. fed up with using Edit to search for all instances of variable a, and having
  277. it stop three times in each occurrence of variable aardvark.    
  278.  
  279. WARNINGS
  280.  
  281.    Even excluding any possible bugs Ed is a dangerous program to use. There
  282. are many possibilities for loosing your work or your files.
  283.    On loading a file Ed replaces tabs by single spaces. It ignores all other
  284. control and top bit set characters except for cariage return and line feeds.
  285. It saves using only line feeds. It splits all lines that are too long for
  286. it. It deletes trailing blank lines, and trailing spaces from lines.
  287.    Thus you can alter a file just by loading and immediately saving. Loading
  288. and saving a non-text file could lead to disaster.
  289.    You can delete a whole block of lines just by deleting one folded line.
  290.    There are no undo facilities in Ed, and no backup file system.
  291.    Ed just ignores most invalid commands, it does not usually beep
  292. annoyingly at you or give error messages.
  293.  
  294. RECONSTRUCTING THE OBJECT CODE
  295.  
  296.   Ed can be reconstructed by compiling the seven source code files using
  297. Acorn's ANSI c v3. The two header files need to be in an h directory. The
  298. RISC_OSLib headers also need to be found. The seven object files need to be
  299. linked together with RISC_OSLib and the standard c library stubs. You can
  300. use the Makefile provided. You may have to alter the directories where the
  301. libraries and their headers are found. You will need to create o and l
  302. directories.
  303.   Ed was constructed on a 1Mb A310 with 20Mb hard disk. To compile on a 1Mb
  304. machine the RunMake obey file can be used to run AMU. You will need the
  305. memory fairly  clear of modules. It was nice to find that I could compile
  306. successfully while Ed was present but not while Edit was present.
  307.  
  308. HOW IT WORKS (Very briefly)
  309.  
  310. Three structures doc,wind and line are defined in h.EdHdr. The program keeps
  311. a doubly linked list of docs,each of which points to doubly linked lists of
  312. winds and lines. These are obtained from a linked list of empty lines.The
  313. size of a line must be an exact divisor of the pagesize. It is currently 128
  314. bytes. The size of a doc and a wind must be no more than the size of a line.
  315.    Ed uses 128 bytes even to store an empty line, so it is wasteful of
  316. memory. However there should be no difficulty with source code files of any
  317. reasonable size.
  318.  A fold is stored as a linked list of lines attached to the displayed top
  319. line. The current line cline and its line number clinen must be kept in sync
  320. to keep the display correct.
  321.  
  322. KNOWN PROBLEMS
  323.  
  324.    Ed does not restart the closedown sequence after a <CtrlShift>F12 if you
  325. reply [YES] to  "Quit without saving?".
  326.  
  327.    The indentation is not yet as desired. It could probably never be perfect,
  328. You would have to read header files and do macro expansion!
  329.  
  330.    I'm a bit suspicious about what happens when Ed runs out of memory.
  331.  
  332. CHANGES FROM VERSION 0.0
  333.     Bug fix - the ~ character is now accepted.
  334.     Bug fix - the delete character key does not leave stray characters.
  335.     Copy and Move step the caret and the mark on one line.
  336.     Modified files are marked with * on the title bar.
  337.     Tab characters are converted to a space when a file is read.
  338.     The read errors option has been moved to the window menu, to allow
  339. errors in a #include file to be read, and #line directives obeyed.
  340.     The indenting algorithm now ignores { or } in "strings", 'character
  341. quotes' or /* comments */.
  342.     Ed$X macros introduced, <Return> and "insert block" moved to macros.
  343.     Closing a window with <Alter> opens the source directory.
  344.     Squeeze option removed (buggy and not used).
  345.  
  346. TO DO (?)
  347.     Add a bracket checking option.
  348.     Implement RAM transfer.
  349.     Improve indentation.
  350.     Interface, possibly through the run line option, with Unix-like
  351. utilities, in particular to search for definitions in RISC_OSLIB headers. 
  352.  
  353. COMMENTS PLEASE
  354.  
  355.                  I would welcome bug reports, criticism (constructive or
  356. otherwise), modifications or suggestions for modifications.
  357.  
  358.                   Chris Stretch
  359.                                  Archive BBS No.62
  360.                          CBTP13@JANET%UK.AC.ULSTER.UCVAX
  361.